<?php
/**
 * Created by PhpStorm.
 * User: HuQiang
 * Date: 2018/7/11
 * Time: 10:11
 */

namespace app\api\controller;



use think\Controller;
use think\Request;

class BaseController extends Controller
{
    /**
     * 接口鉴权方法
     * @param $app_key  客户端传递过来的加密串
     * @return bool
     */
    public function check_auth($app_key){
        $path = Request::instance()->path();
        $serkey = md5(config('AJKEY').$path);
        if ($app_key != $serkey || empty($app_key)){
            return false;
        }else{
           return true;
        }
    }

//    public function success($msg,$data)
//    {
//        return json(['code'=>1,'msg'=>$msg,'data'=>$data]);
//    }
//
//    public function error($code,$msg){
//        return json(['code'=>$code,'msg'=>$msg,'data'=>'']);
//    }
}